package WaiBao;

import java.util.Arrays;

public class LiuJiaJia {
    public static void main(String[] args) {
        String[] name= {"贾土豆(班长)", "张弦弦(副班长)", "小李(学习委员)", "李二牛(文艺委员)", "李上调", "往下跳", "蚊子", "苍蝇", "小青蛙", "小蝌蚪", "鸭子", "可达鸭",
                "火鸡", "袋鼠", "旺财", "大黄", "槐树", "陈璇肖", "李嘟嘟", "张小胖", "闫荣耀", "鲤鱼", "鲫鱼", "草鱼", "鲫鱼", "混子", "龙虾", "奥龙",
                "张杰", "刘佳佳 (学生)"};//考生本人:刘佳佳 (学生)
        int[] age = {20, 20,19,19,22, 21, 21, 19, 18, 22,19, 21, 20, 19, 18,20, 18, 19, 20, 19, 19,21, 21, 21, 20, 23, 19,22,21, 20};//考生年龄：20岁

        double[] erhuan1 = {84, 65, 80, 81, 61, 81, 84, 88, 75, 67, 83, 75, 85, 75, 75, 68, 69, 99, 96, 88, 82, 91, 95, 88, 75, 74, 84, 76, 75, 95};
        double[] erhuan2 = {89, 85, 94, 75, 75, 85, 85, 84, 81, 84, 78, 81, 74, 76, 68, 65, 86, 74, 86, 68, 82, 75, 90, 96, 85, 84, 84, 81, 92, 97};
        double[] erhuan3 = {79, 86, 94, 84, 74, 69, 89, 89, 80, 68, 83, 87, 75, 75, 65, 61, 89, 69, 96, 93, 95, 81, 85, 95, 79, 81, 79, 78, 79, 96};

        double xiaoyu1;//代表每个学生的总分
        double xiaoyu2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            xiaoyu1 =erhuan1[i] +erhuan2[i] +erhuan3[i];
//            xiaoyu2 = (xiaoyu1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + xiaoyu1);
//            System.out.println(name[i] + "的平均分为:" +xiaoyu2);
//        }


        double kankan1 = 0,kankan2 = 0;
        double[] geci = new double[30];
//        for (int i = 0; i < 30; i++) {
//            kankan1 = erhuan1[i] + erhuan2[i] +erhuan3[i];
//            kankan2= (kankan1 * 1.0) / 3;
//            geci[i] = kankan2;
//        }
//
//        for (int i = 0; i < geci.length - 1; i++) {
//            for (int j = 0; j <geci.length - i - 1; j++) {
//                if (geci[j] < geci[j + 1]) {
//                    double tep =geci[j];
//                    geci[j] =geci[j + 1];
//                    geci[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(geci[i]);
//        }


        double zhijia1 = 0,zhijia2 = 0, zhijia3 = 0;//计算每门课的平均分
        double shubiao1 = 0,shubiao2 = 0, shubiao3 = 0;//计算每门课标准差
        double liuye1 = 0,liuye2 = 0,liuye3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <erhuan1.length; i++) {
            sum2+=erhuan1[i];
        }
        zhijia1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+zhijia1);
        double Sum = 0;
        for (int i = 0; i <erhuan2.length; i++) {
            Sum+=erhuan2[i];
        }
        zhijia2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+zhijia2);
        double sum = 0;
        for (int i = 0; i <erhuan3.length; i++) {
            sum+=erhuan3[i];
        }
        zhijia3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+zhijia3);


//
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <erhuan1.length; i++) {
            c1+= (erhuan1[i] -zhijia1)*(erhuan1[i] - zhijia1);
        }
        shubiao1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+shubiao1);

        for (int i = 0; i < erhuan2.length; i++) {
            c2+= (erhuan2[i] -zhijia2)*(erhuan2[i] - zhijia2);
        }
        shubiao2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+shubiao2);

        for (int i = 0; i <erhuan3.length; i++) {
            c3+= (erhuan3[i] -zhijia3)*(erhuan3[i] - zhijia3);
        }
        shubiao3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+shubiao3);
////////////////
//////////////
        Arrays.sort(erhuan1);
        Arrays.sort(erhuan2);
        Arrays.sort(erhuan3);
        liuye1 =(erhuan1[14]+erhuan1[15])*1.0/2;
        liuye2 =(erhuan2[14]+erhuan2[15])*1.0/2;
        liuye3 =(erhuan3[14]+erhuan3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+ liuye1);
        System.out.println("微生物学的中位数为:"+liuye2);
        System.out.println("人体组织解剖学的中位数为:"+liuye3);




    }
}
